package com.gitee.sop.notifyexample.open.impl;

import com.gitee.sop.notifyexample.open.OpenNotify;
import com.gitee.sop.notifyexample.open.req.CreateOrderRequest;
import com.gitee.sop.notifyexample.open.resp.CreateOrderResponse;
import com.gitee.sop.notifyexample.service.OrderService;
import com.gitee.sop.support.context.OpenContext;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * 开放接口实现
 *
 * @author 六如
 */
@DubboService(validation = "true")
public class OpenNotifyImpl implements OpenNotify {

    @Autowired
    private OrderService orderService;

    @Override
    public CreateOrderResponse createOrder(CreateOrderRequest request) {
        OpenContext openContext = OpenContext.current();
        CreateOrderResponse response = new CreateOrderResponse();
        String bizNumber = orderService.createOrder(request, openContext);
        response.setOrderNo(bizNumber);
        return response;
    }
}
